# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-frameworks-old
maintainer="team/kde <bribbers@disroot.org>"
pkgname=prison5
pkgver=5.116.0
pkgrel=0
pkgdesc="A barcode API to produce QRCode barcodes and DataMatrix barcodes"
arch="all !armhf" # armhf blocked by qt5-qtdeclarative
url="https://community.kde.org/Frameworks"
license="MIT"
depends_dev="
	libdmtx-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtmultimedia-dev
	zxing-cpp-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	libqrencode-dev
	qt5-qttools-dev
	samurai
	"
_repo_url="https://invent.kde.org/frameworks/prison.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/prison-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-doc"
builddir="$srcdir/prison-$pkgver"

replaces="prison<=5.110.0-r0"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_QCH=ON
	cmake --build build
}

check() {
	# prison-datamatrixtest and prison-qrtest are broken on s390x
	case "$CARCH" in
		s390x) ctest --test-dir build --output-on-failure -E "prison-(datamatrix|qr)test" ;;
		*) ctest --test-dir build --output-on-failure ;;
	esac
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
fa7ad2393a25b8b7d7cea60891ab27e114ea069a78479a90a6e7df219963991e89f477c061fea0d6c680cfe72502e4b40fdf05b55858072825543ca52635bfd0  prison-5.116.0.tar.xz
"
